package huanzhao.erp.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import huanzhao.erp.domain.types.FinanceSettlementType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@TableName(value = "finance_settlement")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FinanceSettlement implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 结算事项发起时间
     */
    @TableField(value = "publish_time")
    private Date publishTime;

    /**
     * 结算完成时间
     */
    @TableField(value = "finish_time")
    private Date finishTime;

    /**
     * 手机id
     */
    @TableField(value = "phone_id")
    private Long phoneId;


    @TableField(value = "type")
    private FinanceSettlementType type;

    /**
     * 结算金额
     */
    @TableField(value = "amount")
    private BigDecimal amount;

    /**
     * 修改后的金额
     */
    @TableField(value = "settled_amount")
    private BigDecimal settledAmount;

    /**
     * 是否撤销
     */
    @TableField(value = "revocation")
    private Boolean revocation;

    /**
     * 说明原因
     */
    @TableField(value = "reason")
    private String reason;

    /**
     * 结算描述
     */
    @TableField(value = "description")
    private String description;

    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public FinanceSettlement(Long phoneId, FinanceSettlementType type, BigDecimal amount, String reason) {
        this.type = type;
        this.amount = amount;
        this.phoneId = phoneId;
        this.reason = reason;
    }
}